#ifndef __VSDL_SYSTEM_H__
#define __VSDL_SYSTEM_H__

#include <SDL/SDL.h>
#include <SDL/SDL_ttf.h>

#define VSDL_SYSTEM_F_SDL_BASIC		(1)
#define VSDL_SYSTEM_F_FONT		(1 << 1)
#define VSDL_SYSTEM_F_AUDIO		(1 << 2)
#define VSDL_SYSTEM_F_EVENT		(1 << 3)
#define VSDL_SYSTEM_F_ALL		(0xFFFF)

#include <iostream>

using namespace std;

class VSDL_RGB;

struct keyConfig{
	int enableRepeat;
	int repeatDelay;
	int repeatInterval;
};

class VSDL_System{
private:
	int initFlags;
	struct keyConfig keySetting;
	int sdlInitFlags;
	int videoFlags;
	int colorDepth;
	char *windowCaption;
protected:
	bool fullScreen;
	int screenWidth;
	int screenHeight;
	SDL_Surface *baseSurf;
	
	friend void VSDL_SystemDefault(VSDL_System &sys);
	friend int VSDL_SystemCreateBaseSurface(VSDL_System &sys);
	friend void VSDL_SystemInitSubSystem(VSDL_System &sys);
public:
	VSDL_System();
	VSDL_System(char *windowCaption);
	VSDL_System(int screenWidth, int screenHeight, char *windowCaption, int colorDepth);
	VSDL_System(int screenWidth, int screenHeight, char *windowCaption, int colorDepth, bool fullScreen);
	int SubSystemInitialized();
	void Resize(int screenWidth, int screenHeight);
	void FillScreen(VSDL_RGB color);
	SDL_Surface *GetSurface()
	{
	    if (baseSurf == NULL){
		   cerr << "Base surface is NULL" << endl;
 		}
		return baseSurf;
	}
	void EnableKeyRepeat();
	void EnableKeyRepeat(int repeatDelay, int repeatInterval);
	void DisableKeyRepeat();
	bool KeyRepeatEnabled();
	void GetKeyRepeat(int *delay, int *interval);
	void End();
};

#endif /*__VSDL_SYSTEM_H__*/
